const { createClient } = require('redis');

const client = createClient({
  url: 'redis://localhost:6379'
});

const connectRedis = async () => {
  try {
    await client.connect();
    console.log('Redis Connected');
  } catch (err) {
    console.error('Redis connection error:', err);
    process.exit(1);
  }
};

module.exports = { 
  connectRedis,
  redisClient: client
};